import("//third-party/unittest/unittest.gni")

unittest("DebugInfoLogicalViewTests") {
  deps = [
    "//llvm/lib/DebugInfo/LogicalView",
    "//llvm/lib/MC/MCDisassembler",
    "//llvm/lib/Target:AllTargetsDescs",
    "//llvm/lib/Target:AllTargetsDisassemblers",
    "//llvm/lib/Target:AllTargetsInfos",
    "//llvm/lib/TargetParser",
    "//llvm/lib/Testing/Support",
  ]
  sources = [
    "CodeViewReaderTest.cpp",
    "CommandLineOptionsTest.cpp",
    "CompareElementsTest.cpp",
    "ELFReaderTest.cpp",
    "LocationRangesTest.cpp",
    "LogicalElementsTest.cpp",
    "SelectElementsTest.cpp",
    "StringPoolTest.cpp",
    "WarningInternalTest.cpp",
  ]

  # DebugInfoLogicalViewTests uses llvm::getInputFileDirectory(), which expects
  # a file called llvm.srcdir.txt next to the test executable that contains
  # the path of the source directory (which contains this file).
  # lit doesn't change the cwd while running googletests, so the cwd isn't
  # well-defined. This means this has to be an absolute path.
  # FIXME: This doesn't work with swarming. This should really be a data
  # dependency, and the cwd while tests requiring input files run should
  # be required to be some fixed directory.
  # FIXME: Also, the GN way is to write this file at build time. But since
  # there's only two uses of this, and since this is a pattern that hopefully
  # will disappear again, and since it doesn't have any measurable performance
  # hit, write the file at GN time.
  # Note: This line here implicitly depends on unittest() setting output_dir to
  # target_out_dir.
  write_file("$target_out_dir/llvm.srcdir.txt", rebase_path("."))
}
